package com.unknowpupil.design.flyweight;

/**
 * @Description: <p>
 * ConcreteFlyWeight具体享元类
 * </p>
 * @Author: <a> w10g </a>
 * @CreateDate: Create in 2020/4/28 11:05
 * @Classname: ConcreteChess
 * @Version: 1.0
 */
public class ConcreteChess implements ChessFlyWeight {


    /**
     * 外部属性。颜色共享
     */
    private String color;

    public ConcreteChess(String color) {
        this.color = color;
    }

    @Override
    public void setColor(String color) {
        this.color = color;
    }

    @Override
    public String getColor() {
        return color;
    }

    @Override
    public void display(Coordinate coordinate) {
        System.out.println("棋子颜色：" + color + "\n 坐标 x:" + coordinate.getX() + "y:" + coordinate.getY());
    }
}
